/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "subgenus")
@NamedQueries({
    @NamedQuery(name = "Subgenus.findAll", query = "SELECT s FROM Subgenus s"),
    @NamedQuery(name = "Subgenus.findByIdsubgenus", query = "SELECT s FROM Subgenus s WHERE s.idsubgenus = :idsubgenus"),
    @NamedQuery(name = "Subgenus.findBySubgenus", query = "SELECT s FROM Subgenus s WHERE s.subgenus = :subgenus")})
public class Subgenus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idsubgenus")
    private Integer idsubgenus;
    @Column(name = "subgenus")
    private String subgenus;
    @OneToMany(mappedBy = "subgenus", fetch = FetchType.LAZY)
    private List<Taxonomicelement> taxonomicelementList;

    public Subgenus() {
    }

    public Subgenus(Integer idsubgenus) {
        this.idsubgenus = idsubgenus;
    }

    public Subgenus(Integer idsubgenus, String subgenus){
        this.idsubgenus = idsubgenus;
        this.subgenus = subgenus;
    }
    
    public Integer getIdsubgenus() {
        return idsubgenus;
    }

    public void setIdsubgenus(Integer idsubgenus) {
        this.idsubgenus = idsubgenus;
    }

    public String getSubgenus() {
        return subgenus;
    }

    public void setSubgenus(String subgenus) {
        this.subgenus = subgenus;
    }

    public List<Taxonomicelement> getTaxonomicelementList() {
        return taxonomicelementList;
    }

    public void setTaxonomicelementList(List<Taxonomicelement> taxonomicelementList) {
        this.taxonomicelementList = taxonomicelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsubgenus != null ? idsubgenus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Subgenus)) {
            return false;
        }
        Subgenus other = (Subgenus) object;
        if ((this.idsubgenus == null && other.idsubgenus != null) || (this.idsubgenus != null && !this.idsubgenus.equals(other.idsubgenus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Subgenus[idsubgenus=" + idsubgenus + "]";
    }

}
